﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPF.Core.Dtos;
using WPF.Core.Models;

namespace WPF.Core.Services
{
    /// <summary>
    /// 账单服务
    /// </summary>
    public class BillService : BaseService<BillModel, Bill>, IBillService
    {
        public async Task<List<BillModel>> GetAll(BillModel.BillPagingInfo paging)
        {
            var model = await Sqlite.Select<Bill>()
    .Where(q => q.Title.Contains(paging.Name))
    .Count(out long count)
    .Page(paging.PageNumber, paging.PageSize)
    .ToListAsync();
            paging.Count = count;
            return mapper.Map<List<BillModel>>(model);
        }
    }
}
